package chapter07;

/**
 * Created by Miracle yaochengwei on 2022/6/20 10:41
 */
public class Object03 {
    public static class Person {
        String name;
        int age;
    }

    //
    public static void main(String[] args) {
    Person p1 = new Person();
    p1.age = 10;
    p1.name= "小明";
    Person p2 = p1;//把p1 赋给p2  让p2指向p1
        p1.age = 80;
        System.out.println(p2.age);

//        Person a = new Person();
//        a.age = 10;
//        a.name = "小明";
//        Person b;
//        b = a;
//        System.out.println(b.name);
//        b.age = 200;
//        b = null;
//        System.out.println(a.age);//200
//        System.out.println(b.age); //异常

    }
}
